package com.backend.modules.task.entity;

import com.backend.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "task_submission_file")
@EqualsAndHashCode(callSuper = true)
@SQLDelete(sql = "UPDATE task_submission_file SET deleted = true WHERE id = ?")
@Where(clause = "deleted = false")
public class TaskSubmissionFile extends BaseEntity {
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "submission_id")
    private TaskSubmission submission;
    
    @Column(name = "submission_id", insertable = false, updatable = false)
    private Long submissionId;

    @Column(nullable = false)
    private String fileName;

    @Column(nullable = false)
    private String fileUrl;

    @Column(nullable = false)
    private Long fileSize;

    @Column(nullable = false)
    private String fileType;

    private Integer sort = 0;
} 